/**
 * ESP8266 WiFi模块驱动头文件
 * 使用UART串口通信
 */

#ifndef __ESP8266_H
#define __ESP8266_H

#include "stm32f10x.h"

// ESP8266连接状态
typedef enum {
    ESP8266_DISCONNECTED = 0,
    ESP8266_CONNECTED,
    ESP8266_ERROR
} ESP8266_Status;

// WiFi配置结构体
typedef struct {
    char ssid[32];
    char password[32];
    char server_ip[16];
    uint16_t server_port;
} WiFi_Config;

// 函数声明
void ESP8266_Init(void);
ESP8266_Status ESP8266_Get_Status(void);
uint8_t ESP8266_Connect_WiFi(const char *ssid, const char *password);
uint8_t ESP8266_Connect_Server(const char *ip, uint16_t port);
uint8_t ESP8266_Send_Data(const char *data);
uint8_t ESP8266_Send_AT_Command(const char *cmd, const char *expected, uint32_t timeout);
void ESP8266_Process_Response(char *response);

#endif
